﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace Artech.Core.Configuration
{
    /// <summary>
    /// The <see cref="ThreadStaticContextProvider"/> specific configuraiton element.
    /// </summary>
    public class ThreadStaticContextProviderData : ContextProviderDataBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadStaticContextProviderData"/> class.
        /// </summary>
        public ThreadStaticContextProviderData() { }


        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadStaticContextProviderData"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public ThreadStaticContextProviderData(Type type)
            : base(null, type) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadStaticContextProviderData"/> class.
        /// </summary>
        /// <param name="name">The name of the element.</param>
        /// <param name="type">The <see cref="Type" /> that this element is the configuration for.</param>
        public ThreadStaticContextProviderData(string name, Type type)
            : base(name, type) { }

        /// <summary>
        /// Creates the provider.
        /// </summary>
        /// <param name="configurationSource">The configuration source.</param>
        /// <returns>The expression to create <see cref="ThreadStaticContextProvider"/>.</returns>
        protected override Expression<Func<IContextProvider>> CreateProvider(IConfigurationSource configurationSource)
        {
            return () => new ThreadStaticContextProvider();
        }
    }
}
